import java.lang.reflect.Array;
import java.util.Scanner;
import java.util.Arrays;
public class test8 {
    public static int fun4(int a){
        if (a<=10){
            return a;
        }
      return a%10+fun4(a/10);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b= fun4(a);
        System.out.println(b);

    }
        public static void main6(String[] args) {
            for(int num = 10000; num < 100000; num++) {
                int sum = 0;
                for(int i = 0; i < 5; i++) {
                    int left = num / (int)Math.pow(10, i);
                    int right = num % (int)Math.pow(10, i);
                    sum += left * right;
                }
                if(sum == num) {
                    System.out.print(num + " ");
                }
            }
        }

    public static int fun3(int n){
        if(n==1){
            return 1;
        }
        return n*fun3(n-1);
    }
    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b=fun3(a);
        System.out.println(b);
    }

    public static void printArray(int[] array){
        for (int i=0;i<array.length;i++){
            System.out.print(array[i]+"");
            System.out.print(" ");
        }
        }

    public static void main1(String[] args) {
        int[] array=new int[100];
        for (int i=0;i<array.length;i++){
            array[i]=i+1;
        }

        printArray(array);
        //System.out.println(Arrays.toString(array));
    }
        public static void main2(String[] args){
            Scanner in = new Scanner(System.in);
            int secs = in.nextInt();
            int hour = secs / 3600;
            int min = secs % 3600 / 60;
            int sec = secs % 60;
            System.out.println(hour + " " + min + " " + sec);
        }
    public static int fun(int a){
        if(a<10){
            a =a+fun(a+1);
        }
        return a;
    }
    public static void main3(String[] args) {
        int a=1;
        int b =fun(a);
        System.out.println(b);
    }
public static void fun2(int a){
        if(a>9){
            fun2(a/10);
        }
    System.out.println(a%10);

}
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        fun2(n);

    }
    }




